package com.aaa.controller;


import com.aaa.pojos.Emp;
import com.aaa.pojos.Login;
import com.aaa.pojos.Result;
import com.aaa.service.EmpService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/login")
public class LoginController {

    @Resource
    private EmpService empService;


    @PostMapping
    public Result empLog(@RequestBody Emp emp){
        Login login=empService.empLog(emp);
        if (login != null) {
            return Result.success(login);
        }
        return Result.error("账号或密码错误");
    }
}
